package com.union.vehicleassistant.bean;

import java.io.File;

public class Adjunct implements IAdjunct {


    private String fileName;
    private String onlineUrl;
    private String localFile;

    public Adjunct() {
    }

    public Adjunct(String fileName, String onlineUrl) {
        this.fileName = fileName;
        this.onlineUrl = onlineUrl;
    }

    public Adjunct(String localFile) {
        this.localFile = localFile;
    }

    @Override
    public String getLocalPath() {
        return localFile;
    }

    public String getLocalFile() {
        return localFile;
    }

    public Adjunct setLocalFile(String localFile) {
        this.localFile = localFile;
        return this;
    }

    public Adjunct setOnlineUrl(String onlineUrl) {
        this.onlineUrl = onlineUrl;
        return this;
    }

    @Override
    public String getFileUrl() {
        return onlineUrl;
    }

    @Override
    public String getFileName() {

        if (null != localFile) {
            return new File(localFile).getName();
        }

        return fileName;
    }
}
